﻿import QtQuick 2.0

Image {
    id: ball
    width: 100
    height: 100
    source: {
        if(type==0){
            ""
        }
        else{
            "qrc:/img/img/ball" + String(type) + ".png"
        }
    }

    property int type: 1

    function distroyBall(){
        anim.source = "qrc:/img/img/ball" + String(type) + ".gif"
        anim.paused = false
        type = 0
//        console.log("ball.qml anim frameCount=", anim.frameCount)
    }

    AnimatedImage{
        id: anim
        anchors.centerIn: parent
        paused: true
        onCurrentFrameChanged: {
            if(currentFrame==anim.frameCount-1){
                anim.paused = true
                anim.source = ""
            }
        }
    }
}

